package com.atguigu.service.impl;

import com.atguigu.dao.AdminDao;
import com.atguigu.dao.BaseDao;
import com.atguigu.dao.HouseBrokerDao;
import com.atguigu.entity.Admin;
import com.atguigu.entity.HouseBroker;
import com.atguigu.service.HouseBrokerService;
import com.atguigu.service.ipml.BaseServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
@DubboService
public class HouseBrokerServiceImpl extends BaseServiceImpl<HouseBroker> implements HouseBrokerService {
    @Autowired
    private HouseBrokerDao houseBrokerDao;
    @Autowired
    private AdminDao adminDao;

    @Override
    public BaseDao<HouseBroker> getDao() {
        return houseBrokerDao;
    }

    @Override
    public List<HouseBroker> findHouseBrokerByHouseId(Long houseId) {
        return houseBrokerDao.findHouseBrokerByHouseId(houseId);
    }

    @Override
    public List<Admin> findOtherBrokerByHouseId(Long houseId) {
        //1.查找当前所有的经纪人id值查询出
        List<Long> houseBrokerIds = houseBrokerDao.findHouseBrokerIdByHouseId(houseId);
        //2.查询所有的员工,排除上边所有的id值
        List<Admin> adminList = adminDao.findOtherAdminByAdminId(houseBrokerIds);
        return adminList;
    }
}
